//
// Created by jiangpenghui on 2023/4/18.
//

#ifndef CMAKECXX_MULTIPLEINHERITANCE_H
#define CMAKECXX_MULTIPLEINHERITANCE_H

#include <iostream>
#include <sstream>
#include <string>

class Printable {

public:
    virtual ~Printable() {};

    virtual void print(std::ostream &) const = 0;
};

class Intable {
public:
    virtual ~Intable() {}

    virtual int toInt() const = 0;
};


class Stringable {
public:
    virtual ~Stringable() {}

    virtual int toString() const = 0;
};

class Able : public Printable, Intable, Stringable {
    int myData;
public:
    Able(int x) : myData(x) {
        std::cout << "Able : is " << x << std::endl;
    }

    void print(std::ostream &os) const {
        os << myData;
    }

    int toInt() const {
        return myData;
    }

};

#endif //CMAKECXX_MULTIPLEINHERITANCE_H
